package com.gdyx.app.web.svc.impl;

import com.gdyx.app.web.dao.MpsRoleDao;
import com.gdyx.app.web.model.MpsRole;
import com.gdyx.app.web.svc.MpsRoleSvc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 * Created by mac on 2017/7/10.
 */
@Service
public class MpsRoleSvcImpl implements MpsRoleSvc {
    @Autowired
    MpsRoleDao dao;

    @Override
    public void save(MpsRole o) {
        o.setId(UUID.randomUUID().toString().trim().toUpperCase());
        o.setCreateTime(new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
        dao.save(o);
    }

    @Override
    public void saveOrUpdate(MpsRole o) {
        dao.saveOrUpdate(o);
    }

    @Override
    public void delete(String id) {
        dao.delete(id);
    }

    @Override
    public void update(MpsRole o) {
        o.setModifyTime(new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
        dao.update(o);
    }

    @Override
    public MpsRole findMpsRoleById(String id) {
        return dao.findMpsRoleById(id);
    }

    @Override
    public int count(Map<String, Object> map) {
        return dao.count(map);
    }

    @Override
    public List<MpsRole> findMpsRoles(Map<String, Object> map) {
        return dao.findMpsRoles(map);
    }

    @Override
    public List<MpsRole> findMpsRoleByOId(String id) {
        return dao.findMpsRoleByOId(id);
    }

}
